<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
	<title>我的工资</title>
	<link rel="stylesheet" href="__PUBLIC__/Pay/css/bootstrap.min.css">
	<link rel="stylesheet" href="__PUBLIC__/Pay/css/weui.min.css"/>
	<link rel="stylesheet" href="__PUBLIC__/Pay/css/bootstrap-datetimepicker.min.css">
	<script src="__PUBLIC__/Pay/js/jquery-1.8.2.min.js"></script>
	<script src="__PUBLIC__/Pay/js/bootstrap.min.js"></script>
	<script src="__PUBLIC__/Pay/js/jquery-1.8.2.min.js"></script>
	<script src="__PUBLIC__/Pay/js/bootstrap-datetimepicker.fr.js"></script>
	<script src="__PUBLIC__/Pay/js/bootstrap-datetimepicker.js"></script>
	<script src="__PUBLIC__/Pay/js/bootstrap-datetimepicker.zh-CN.js"></script>
    <style>
        body{
            font-family: Microsoft YaHei;
        }
        .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{
            border:0px solid #ddd;
        }
        #footer{
            margin-top:30px;
        }
        .table{
            margin-bottom:0px;
        }

    </style>
</head>
<body>
	<div style="text-align: center;margin-top:4%; margin-bottom:4%">
		<img src="__PUBLIC__/Pay/img/logo.png" alt="logo" width="40%">
	</div>
    <form action="{:U('Pay/Index/info')}" method="post" id="form1">
		<table class="table">
			<tr class="text-center bg-primary">
				<td>
					工资查询
				</td>
			</tr>
		</table>
        <div class="form-group">
            <label for="dtp_input1" class="col-md-2 control-label">按月条件查询</label>
            <div class="input-group date form_datetime1 col-md-5" data-date="" data-date-format="dd MM yyyy" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
                <input class="form-control" size="16" type="text"  readonly name="time" id="one">
                <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                <span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
            </div>
            <input type="hidden" id="dtp_input1" value="" /><br/>
        </div>
    </form>
    <form action="{:U('Pay/Index/Statistics')}" method="post" id="form2">
        <div class="form-group">
            <label for="dtp_input1" class="col-md-2 control-label">统计起始时间</label>
            <div class="input-group date form_datetime2 col-md-5" data-date-format="dd MM yyyy" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
                <input class="form-control" size="16" type="text" readonly name="start" id="start">
                <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                <span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
            </div>
            <input type="hidden" id="dtp_input1" value="" /><br/>
        </div>
        <div class="form-group">
            <label for="dtp_input1" class="col-md-2 control-label">统计结束时间</label>
            <div  class="input-group date form_datetime2 col-md-5" data-date-format="dd MM yyyy" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
                <input class="form-control" size="16" type="text" readonly name="end" id="end">
                <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                <span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
            </div>
            <input type="hidden" id="dtp_input1" value="" /><br/>
            </div>
	        <table class="table">
		    <tr>
                <td>
                    <!-- <button  class="weui-btn weui-btn_plain-primary" id="tj">统计开始查询</button> -->
                    <input type="button" class="btn btn-primary btn-block" id="tj" value="按时间段统计查询">
                </td>
                <td>
                    <!-- <button  class="weui-btn weui-btn_plain-primary" id="cx">按月开始查询</button> -->
                    <input type="button" class="btn btn-primary btn-block" id="cx"   value="按月开始查询">
                </td>
		    </tr>
	        </table>
    </form>
	<div class="weui-footer "  >
        <p class="weui-footer__links">
            <a href="javascript:void(0);" class="weui-footer__link">中国航天-神舟软件</a>
        </p>
        <p class="weui-footer__text">Copyright &copy; 2008-2016 </p>
    </div>
    <div class="js_dialog" id="iosDialog2" style="display: none;">
        <div class="weui-mask"></div>
        <div class="weui-dialog">
            <div class="weui-dialog__bd"></div>
            <div class="weui-dialog__ft">
                <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary" id="qr">确定</a>
            </div>
        </div>
    </div>
</body>
<script>
    var d = new Date();
    var edate = (d.getFullYear()+1) + "-" +(d.getMonth() +1 ) + "-" + d.getDate();
    $('.form_datetime1').datetimepicker({
        language:  'zh-CN',
        format: "yyyy-mm",
        startDate:'2013-01-01',
        endDate:edate,
        weekStart: 1,
        todayBtn:1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 3,
        minView:4,
        maxView:2,
        todayBtn:1,
    });
                                                        
    $('.form_datetime2').datetimepicker({
        language:  'zh-CN',
        format: "yyyy-mm",
        startDate:'2013-01-01',
        endDate:edate,
        weekStart: 1,
        todayBtn:1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 3,
        minView:4,
        maxView:2,
        todayBtn:1,
        pickerPosition: "top-left",
    });
	$(function(){
		$('#cx').click(function(){
            var time = $("#one").val();
            if(!time){
                $('.weui-dialog__bd').text('请您输入按月查询时间');
                $('#iosDialog2').show();
                return false;
            }else{
                $('#form1').submit();
            }
		});
		$('#tj').click(function(){
			var time1 = $("#start").val();
			var time2 = $("#end").val();
			var t1 = Date.parse(new Date(time1));
			var t2 = Date.parse(new Date(time2));
			var St3 = new Date(time1);
			var Et4 = new Date(time2);
			var SY = St3.getYear();  
			var EY = Et4.getYear();
			if(!time1){
				$('.weui-dialog__bd').text('统计起始时间不能为空');
				$('#iosDialog2').show();
				return false;
			}else
			if(!time2){
				$('.weui-dialog__bd').text('统计结束时间不能为空');
				$('#iosDialog2').show();
				return false;
			}else
			if(t1 >= t2){
				$('.weui-dialog__bd').text('结束时间不能小于等于起始时间');
				$('#iosDialog2').show();
				return false;
			}else
			if(SY != EY){
				$('.weui-dialog__bd').text('统计查询条件必须是一整年内');
				$('#iosDialog2').show();
				return false;
			}else{
				$('#form2').submit();
			}
		});
		$('#qr').click(function(){
			$('#iosDialog2').hide();
		})
	})
</script>
</html>